package com.kangfu.api.controller;

import com.kangfu.db.model.request.LoginRequest;
import com.kangfu.api.service.ILoginService;
import com.kangfu.common.annotation.IgnoreAuth;
import com.kangfu.common.model.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    public ILoginService loginService;

    @PostMapping("")
    @IgnoreAuth
    public AjaxResult login(@RequestBody LoginRequest loginRequest) {
        HashMap<String, Object> hashMap = loginService.login(loginRequest.getCode());
        return AjaxResult.success(hashMap);
    }

}
